﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using V = Science.Mathematics.VectorCalculus;

namespace VectorCalculus5Ed.Chapter2.Section4
{
    public class Example03
    {
        public Example03()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
        public void Compute()
        {
            V.Function.ToLastType<double, double[]> map
                = new V.Function.ToLastType<double, double[]>(func);
            V.Path p = new V.Path(map);
            p.ParameterFrom = -2.0;
            p.ParameterTo = 2.0;
            V.Curve c = new V.Curve(p);
            c.Find(0.01);
            for (int i = 0; i < c.CoordinatesOfPoints.Count; i++)
            {
                double[] y = (double[])c.CoordinatesOfPoints[i];
                result += y[0].ToString() + "\t  ";
                result += y[1].ToString() + "\r\n";
            }
        }
        private double[] func(double t)
        {
            double[] r = new double[2];
            r[0] = t;
            r[1] = t*t;
            return r;
        }
    }
}
/*
-2	  4
-1.99	  3.9601
-1.98	  3.9204
-1.97	  3.8809
-1.96	  3.8416
-1.95	  3.8025
-1.94	  3.7636
-1.93	  3.7249
-1.92	  3.6864
-1.91	  3.6481
-1.9	  3.61
-1.89	  3.5721
-1.88	  3.5344
-1.87	  3.4969
-1.86	  3.4596
-1.85	  3.4225
-1.84	  3.3856
-1.83	  3.3489
-1.82	  3.3124
-1.81	  3.2761
-1.8	  3.24
-1.79	  3.2041
-1.78	  3.1684
-1.77	  3.1329
-1.76	  3.0976
-1.75	  3.0625
-1.74	  3.0276
-1.73	  2.9929
-1.72	  2.9584
-1.71	  2.9241
-1.7	  2.89
-1.69	  2.8561
-1.68	  2.8224
-1.67	  2.7889
-1.66	  2.7556
-1.65	  2.7225
-1.64	  2.6896
-1.63	  2.6569
-1.62	  2.6244
-1.61	  2.5921
-1.6	  2.56
-1.59	  2.5281
-1.58	  2.4964
-1.57	  2.4649
-1.56	  2.4336
-1.55	  2.4025
-1.54	  2.3716
-1.53	  2.3409
-1.52	  2.3104
-1.51	  2.2801
-1.5	  2.25
-1.49	  2.2201
-1.48	  2.1904
-1.47	  2.1609
-1.46	  2.1316
-1.45	  2.1025
-1.44	  2.0736
-1.43	  2.0449
-1.42	  2.0164
-1.41	  1.9881
-1.4	  1.96
-1.39	  1.9321
-1.38	  1.9044
-1.37	  1.8769
-1.36	  1.8496
-1.35	  1.8225
-1.34	  1.7956
-1.33	  1.7689
-1.32	  1.7424
-1.31	  1.7161
-1.3	  1.69
-1.29	  1.6641
-1.28	  1.6384
-1.27	  1.6129
-1.26	  1.5876
-1.25	  1.5625
-1.24	  1.5376
-1.23	  1.5129
-1.22	  1.4884
-1.21	  1.4641
-1.2	  1.44
-1.19	  1.4161
-1.18	  1.3924
-1.17	  1.3689
-1.16	  1.3456
-1.15	  1.3225
-1.14	  1.2996
-1.13	  1.2769
-1.12	  1.2544
-1.11	  1.2321
-1.1	  1.21
-1.09	  1.1881
-1.08	  1.1664
-1.07	  1.1449
-1.06	  1.1236
-1.05	  1.1025
-1.04	  1.0816
-1.03	  1.0609
-1.02	  1.0404
-1.01	  1.0201
-1	  1
-0.99	  0.9801
-0.98	  0.9604
-0.97	  0.9409
-0.96	  0.9216
-0.95	  0.9025
-0.94	  0.8836
-0.93	  0.8649
-0.92	  0.8464
-0.91	  0.8281
-0.9	  0.81
-0.89	  0.7921
-0.88	  0.7744
-0.87	  0.7569
-0.86	  0.7396
-0.85	  0.7225
-0.84	  0.7056
-0.83	  0.6889
-0.82	  0.6724
-0.81	  0.6561
-0.8	  0.64
-0.79	  0.6241
-0.78	  0.6084
-0.77	  0.5929
-0.76	  0.5776
-0.75	  0.5625
-0.74	  0.5476
-0.73	  0.5329
-0.72	  0.5184
-0.71	  0.5041
-0.7	  0.49
-0.69	  0.4761
-0.68	  0.4624
-0.67	  0.4489
-0.66	  0.4356
-0.65	  0.4225
-0.64	  0.4096
-0.63	  0.3969
-0.62	  0.3844
-0.61	  0.3721
-0.6	  0.36
-0.59	  0.3481
-0.58	  0.3364
-0.57	  0.3249
-0.56	  0.3136
-0.55	  0.3025
-0.54	  0.2916
-0.53	  0.2809
-0.52	  0.2704
-0.51	  0.2601
-0.5	  0.25
-0.49	  0.2401
-0.48	  0.2304
-0.47	  0.2209
-0.46	  0.2116
-0.45	  0.2025
-0.44	  0.1936
-0.43	  0.1849
-0.42	  0.1764
-0.41	  0.1681
-0.4	  0.16
-0.39	  0.1521
-0.38	  0.1444
-0.37	  0.1369
-0.36	  0.1296
-0.35	  0.1225
-0.34	  0.1156
-0.33	  0.1089
-0.32	  0.1024
-0.31	  0.0961
-0.3	  0.09
-0.29	  0.0841
-0.28	  0.0784
-0.27	  0.0729
-0.26	  0.0676
-0.25	  0.0625
-0.24	  0.0576
-0.23	  0.0529
-0.22	  0.0484
-0.21	  0.0441
-0.2	  0.04
-0.19	  0.0361
-0.18	  0.0324
-0.17	  0.0289
-0.16	  0.0256
-0.15	  0.0225
-0.14	  0.0196
-0.13	  0.0169
-0.12	  0.0144
-0.11	  0.0121
-0.0999999999999999	  0.00999999999999997
-0.0899999999999999	  0.00809999999999998
-0.0800000000000001	  0.00640000000000001
-0.0700000000000001	  0.00490000000000001
-0.0600000000000001	  0.00360000000000001
-0.05	  0.0025
-0.04	  0.0016
-0.03	  0.000900000000000002
-0.02	  0.000400000000000001
-0.01	  0.0001
0	  0
0.0100000000000002	  0.000100000000000005
0.02	  0.000400000000000001
0.0300000000000002	  0.000900000000000015
0.04	  0.0016
0.0499999999999998	  0.00249999999999998
0.0600000000000001	  0.00360000000000001
0.0699999999999998	  0.00489999999999998
0.0800000000000001	  0.00640000000000001
0.0899999999999999	  0.00809999999999998
0.1	  0.01
0.11	  0.0121
0.12	  0.0144
0.13	  0.0169
0.14	  0.0196
0.15	  0.0225
0.16	  0.0256
0.17	  0.0289
0.18	  0.0324000000000001
0.19	  0.0361
0.2	  0.0400000000000001
0.21	  0.0441
0.22	  0.0484000000000001
0.23	  0.0529
0.24	  0.0576000000000001
0.25	  0.0625
0.26	  0.0676000000000001
0.27	  0.0729
0.28	  0.0784000000000001
0.29	  0.0841
0.3	  0.0900000000000002
0.31	  0.0961
0.32	  0.1024
0.33	  0.1089
0.34	  0.1156
0.35	  0.1225
0.36	  0.1296
0.37	  0.1369
0.38	  0.1444
0.39	  0.1521
0.4	  0.16
0.41	  0.1681
0.42	  0.1764
0.43	  0.1849
0.44	  0.1936
0.45	  0.2025
0.46	  0.2116
0.47	  0.2209
0.48	  0.2304
0.49	  0.2401
0.5	  0.25
0.51	  0.2601
0.52	  0.2704
0.53	  0.2809
0.54	  0.2916
0.55	  0.3025
0.56	  0.3136
0.57	  0.3249
0.58	  0.3364
0.59	  0.3481
0.6	  0.36
0.61	  0.3721
0.62	  0.3844
0.63	  0.3969
0.64	  0.4096
0.65	  0.4225
0.66	  0.4356
0.67	  0.4489
0.68	  0.4624
0.69	  0.4761
0.7	  0.49
0.71	  0.5041
0.72	  0.5184
0.73	  0.5329
0.74	  0.5476
0.75	  0.5625
0.76	  0.5776
0.77	  0.5929
0.78	  0.6084
0.79	  0.6241
0.8	  0.64
0.81	  0.6561
0.82	  0.6724
0.83	  0.6889
0.84	  0.7056
0.85	  0.7225
0.86	  0.7396
0.87	  0.7569
0.88	  0.7744
0.89	  0.7921
0.9	  0.81
0.91	  0.8281
0.92	  0.8464
0.93	  0.8649
0.94	  0.8836
0.95	  0.9025
0.96	  0.9216
0.97	  0.9409
0.98	  0.9604
0.99	  0.9801
1	  1
1.01	  1.0201
1.02	  1.0404
1.03	  1.0609
1.04	  1.0816
1.05	  1.1025
1.06	  1.1236
1.07	  1.1449
1.08	  1.1664
1.09	  1.1881
1.1	  1.21
1.11	  1.2321
1.12	  1.2544
1.13	  1.2769
1.14	  1.2996
1.15	  1.3225
1.16	  1.3456
1.17	  1.3689
1.18	  1.3924
1.19	  1.4161
1.2	  1.44
1.21	  1.4641
1.22	  1.4884
1.23	  1.5129
1.24	  1.5376
1.25	  1.5625
1.26	  1.5876
1.27	  1.6129
1.28	  1.6384
1.29	  1.6641
1.3	  1.69
1.31	  1.7161
1.32	  1.7424
1.33	  1.7689
1.34	  1.7956
1.35	  1.8225
1.36	  1.8496
1.37	  1.8769
1.38	  1.9044
1.39	  1.9321
1.4	  1.96
1.41	  1.9881
1.42	  2.0164
1.43	  2.0449
1.44	  2.0736
1.45	  2.1025
1.46	  2.1316
1.47	  2.1609
1.48	  2.1904
1.49	  2.2201
1.5	  2.25
1.51	  2.2801
1.52	  2.3104
1.53	  2.3409
1.54	  2.3716
1.55	  2.4025
1.56	  2.4336
1.57	  2.4649
1.58	  2.4964
1.59	  2.5281
1.6	  2.56
1.61	  2.5921
1.62	  2.6244
1.63	  2.6569
1.64	  2.6896
1.65	  2.7225
1.66	  2.7556
1.67	  2.7889
1.68	  2.8224
1.69	  2.8561
1.7	  2.89
1.71	  2.9241
1.72	  2.9584
1.73	  2.9929
1.74	  3.0276
1.75	  3.0625
1.76	  3.0976
1.77	  3.1329
1.78	  3.1684
1.79	  3.2041
1.8	  3.24
1.81	  3.2761
1.82	  3.3124
1.83	  3.3489
1.84	  3.3856
1.85	  3.4225
1.86	  3.4596
1.87	  3.4969
1.88	  3.5344
1.89	  3.5721
1.9	  3.61
1.91	  3.6481
1.92	  3.6864
1.93	  3.7249
1.94	  3.7636
1.95	  3.8025
1.96	  3.8416
1.97	  3.8809
1.98	  3.9204
1.99	  3.9601
*/